package UILayer;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class GuiHandler extends JFrame
{
	private static final long serialVersionUID = 1L;					//	Written by jGJ
	
	private JLabel theLabel;			//	whatever that is :-/
	private JTextField item1;			//	
	private JTextField item2;
	private JTextField item3;
	private JPasswordField passwordField;
	
	public GuiHandler()
	{
		super("My Program");
		setLayout(new FlowLayout());
		
		item0 = new JLabel("This is a sentence, or a label I guess");
		item0.setToolTipText("This is going to show up on hover, which means it is a tool tip");
		add(item0);
		
		item1 = new JTextField(10);
		add(item1);
		
		item2 = new JTextField("Enter text here");
		add(item2);
		
		item3 = new JTextField("uneditable", 20);
		item3.setEditable(false);
		add(item3);
		
		passwordField = new JPasswordField("mypass");
		add(passwordField);
		
		TheHandler handler = new TheHandler();
		item1.addActionListener(handler);
		item2.addActionListener(handler);
		item3.addActionListener(handler);
		passwordField.addActionListener(handler);
		
	}
	
	//	All eye candy is initiated... first thing's first!
	
	//	Set background color
	
	public void setBackgroundColor(){
		
	}
	
	public 
	.setBackground(
			
	
	private class TheHandler	implements ActionListener
	{
		
		
		public void actionPerformed(ActionEvent event)
		{
			String string = "";
			
			if(event.getSource() == item1)
			{
				string = String.format("field 1: %s", event.getActionCommand());
			}
			else if(event.getSource() == item2)
			{
				string = String.format("field 2: %s", event.getActionCommand());
			}
			else if(event.getSource() == item3)
			{
				string = String.format("field 3: %s", event.getActionCommand());
			}
			else if(event.getSource() == passwordField)
			{
				string = String.format("password field is : %s", event.getActionCommand());
			}
			
			JOptionPane.showMessageDialog(null, string);
		}
	}
	//		GuiHandler() documentation:
	
	// 		Some function to scale whatever is needed to be scaled in the GUI
	//
	// 		Put a frame or whatever "isVisible"-element into the function 
	//	->	output will be a new frame just scaled with the input float-parameter (percentage - e.g. float 0.5 = 50 "percent" scaling)
	
	// 		The scaling itself is relative to MainFrame - that is too say it "fits" into the MainFrame whenever the function is run.

	public JFrame scale(){
		

		
		return null;
		
	};
	
}
